package com.blog.frontend.pages.parts;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;

import com.blog.frontend.pages.ViewArticlePage;
import com.blog.model.Article;

public class ArticlePreViewer extends Panel {
	private static final long serialVersionUID = -625299615907127715L;
	
	public ArticlePreViewer(final String id) {
		super(id);
	}
	
	public void setArticle(final Article a) {
		
		final Link l = new Link("showLink") {
			private static final long serialVersionUID = 8659331311670811329L;
			
			@Override
			public void onClick() {
				setResponsePage(new ViewArticlePage(a));
			}
		};
		l.add(new Label("title", a.getTitle()));
		add(l);
		add(new Label("id", a.getId().toString()));
	}
	
}